"""
Write a program that takes a list of integers as input, and outputs the values that are repeated in it more than once.

You may need the list method sort to solve this problem.

Input format:
One line with integers, separated by a space.

Output format:
A line with integers, separated by a space. The numbers must not be repeated, the output order can be arbitrary.

编写一个程序，该程序将整数列表作为输入，并输出多次重复的值。

您可能需要对list方法进行排序才能解决此问题。

输入格式：
用整数隔开的一行。

输出格式：
整数行，以空格分隔。 数字不能重复，输出顺序可以是任意的。
"""

# 方法1
from collections import Counter  # 引入Counter
a = list(int(li) for li in input().split())
b = dict(Counter(a))
val = [key for key, value in b.items() if value > 1]
for i in val:
    print(i)

#  方法2
vector = input().split()
print(" ".join(set([x for x in vector if vector.count(x) > 1])))
